<?php

use think\migration\Migrator;
use think\migration\db\Column;

class SystemKnowledge extends Migrator
{
    public function up()
    {
        $table = $this->table('system_knowledge');
        $table
            //step1:名称
            ->addColumn('name_en', 'string', ['limit' => 50, 'default' => '', 'comment' => '简称'])
            ->addColumn('name_cn', 'string', ['limit' => 50, 'default' => '', 'comment' => '中文'])
            ->addColumn('memo', 'string', ['limit' => 50, 'default' => '', 'comment' => '描述'])
            ->addColumn('create_time', 'datetime', ['comment' => '插入时间'])
            ->addColumn('delete_time', 'integer', ['limit' => 11, 'default' => 0, 'comment' => '软删除'])

            //主键
            //->addIndex([''])

            //注释
            ->setComment('系统 - 基本知识')

            //引擎
            ->setEngine('InnoDB')
            ->save();
    }

    public function down()
    {
        $this->table('knowledge_chemical_material')->drop();
    }
}
